package com.bw.day03

import android.os.Bundle
import android.webkit.WebChromeClient
import android.webkit.WebView
import android.webkit.WebViewClient
import androidx.activity.enableEdgeToEdge
import androidx.appcompat.app.AppCompatActivity
import androidx.core.view.ViewCompat
import androidx.core.view.WindowInsetsCompat
import androidx.core.view.isVisible
import com.alibaba.android.arouter.facade.annotation.Autowired
import com.alibaba.android.arouter.facade.annotation.Route
import com.alibaba.android.arouter.launcher.ARouter
import com.bw.base.net.mvvm.BaseViewActivity
import com.bw.day03.databinding.ActivityWebViewBinding
@Route(path = "/app/WebViewActivity")
class WebViewActivity : BaseViewActivity<ActivityWebViewBinding>() {
    @JvmField
    @Autowired

    var url=""
    override fun initView() {
        ARouter.getInstance().inject(this)
        binding.wv.loadUrl(url)
        binding.wv.webViewClient= WebViewClient()
        val webChromeClient=object :WebChromeClient(){
            override fun onProgressChanged(view: WebView?, newProgress: Int) {
                super.onProgressChanged(view, newProgress)
                if (newProgress==100){
                    binding.pb.isVisible=false

                }
                binding.pb.progress=newProgress
            }
        }
        binding.wv.webChromeClient=webChromeClient
        binding.wv.settings.javaScriptEnabled=true
    }

    override fun initData() {

    }

    override fun getLayoutId(): Int = R.layout.activity_web_view

}